const chalk = require("chalk");

// 平台选项配置
const PLATFORM_CHOICES = [
  { name: "🌐 Web", value: "web" },
  { name: "📱 iOS", value: "ios" },
  { name: "🤖 Android", value: "android" },
  { name: "🖥️ React Native", value: "rn" },
  { name: "⚡️ Flutter", value: "flutter" },
];

// 格式选项配置
const FORMAT_CHOICES = {
  web: [{ name: "JSON", value: "json", checked: true }],
  ios: [
    { name: "Strings", value: "strings", checked: true },
    { name: "Localizable.stringsdict", value: "stringsdict" },
  ],
  android: [{ name: "XML", value: "xml", checked: true }],
  rn: [{ name: "JSON", value: "json", checked: true }],
  flutter: [
    { name: "ARB", value: "arb", checked: true },
    { name: "JSON", value: "json" },
  ],
};

// 提示消息配置
const PROMPT_MESSAGES = {
  welcome: chalk.blue("🚀 欢迎使用 i18n-CLI 多语言文件生成工具!"),
  authStep: chalk.cyan("📝 第一步: 飞书应用认证"),
  authDesc: chalk.gray("请输入您的飞书应用凭证信息"),
  tableStep: chalk.cyan("📊 第二步: 表格信息"),
  tableDesc: chalk.gray("请输入要获取的飞书表格信息"),
  configStep: chalk.cyan("⚙️  第三步: 生成配置"),
  configDesc: chalk.gray("请选择要生成的配置"),
  generating: "正在生成多语言文件...",
  success: chalk.green("✅ 多语言文件生成完成!"),
  error: chalk.red("❌ 生成过程中出现错误:"),
};

// 验证函数
const VALIDATORS = {
  required: (input) => input.trim() !== "" || "此字段不能为空",
  appKey: (input) => input.trim() !== "" || "App Key 不能为空",
  appSecret: (input) => input.trim() !== "" || "App Secret 不能为空",
  spreadsheetToken: (input) => input.trim() !== "" || "表格ID不能为空",
  sheetIdentifier: (input) => input.trim() !== "" || "Sheet信息不能为空",
  atLeastOne: (input) => input.length > 0 || "请至少选择一项",
};

function getPrompts() {
  return {
    PLATFORM_CHOICES,
    FORMAT_CHOICES,
    PROMPT_MESSAGES,
    VALIDATORS,
  };
}

module.exports = {
  getPrompts,
  PLATFORM_CHOICES,
  FORMAT_CHOICES,
  PROMPT_MESSAGES,
  VALIDATORS,
};
